

#ifndef GAME_H
#define GAME_H

#include <QWidget>
#include <QTimer>

class QTimer;
class QPainter;

class Game : public QWidget {
  Q_OBJECT

public:
  explicit Game(QWidget *parent = nullptr);

protected:
  void paintEvent(QPaintEvent *event) override;
  void keyPressEvent(QKeyEvent *event) override;

private slots:
  void moveCharacter();
  void spawnObject();

private:
  int character_x_;
  int character_y_;
  int object_x_;
  int object_y_;
  QTimer *timer_;
  bool is_game_over_;

  void drawCharacter(QPainter &painter);
  void drawObject(QPainter &painter);
  void checkCollision();
};
#endif // GAME_H
